CSharpTest.Net
GetOrAdd Method
See Also  Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Collections Namespace > IDictionaryEx<TKey,TValue> Interface : GetOrAdd Method

key
The key of the element to add.
value
The value to be added, if the key does not already exist.

Glossary Item Box

Adds a key/value pair to the IDictionary if the key does not already exist.

Syntax

Visual Basic (Declaration) 
Function GetOrAdd( _
   ByVal key As TKey, _
   ByVal value As TValue _
) As TValue
C# 
TValue GetOrAdd( 
   TKey key,
   TValue value
)

Parameters

key
The key of the element to add.
value
The value to be added, if the key does not already exist.

Exceptions

ExceptionDescription
System.NotSupportedExceptionThe IDictionary is read-only.

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys